﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MasMembers.DAL;

namespace MasMembers
{
    public partial class DeskTopForm : Form
    {
        public UserEntity currentUser;
        public LoginForm loginForm;

        public DeskTopForm()
        {
            InitializeComponent();
        }

        private void ShowNewForm(object sender, EventArgs e)
        {
            MainForm childForm = new MainForm();
            childForm.MdiParent = this;
            childForm.currentUser = currentUser;
            childForm.Show();
        }

        private void GroupsDatatoolStripButton_Click(object sender, EventArgs e)
        {
            GroupsForm childForm = new GroupsForm();
            childForm.MdiParent = this;
            childForm.MdiParent = this;
            childForm.Show();
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            UserForm userForm = new UserForm();
            userForm.currentUser = currentUser.Id;
            userForm.loginForm = loginForm;
            userForm.MdiParent = this;
            userForm.Show();
        }

        private void DeskTopForm_Load(object sender, EventArgs e)
        {
            if (currentUser.UType != User.ADMIN_USER_UType)
              this.GroupsDatatoolStripButton.Visible = false;

            if (currentUser.UType == User.NORMAL_USER_UType)
                this.EvalButtonToolStripButton.Visible = false;

            this.Text = currentUser.UName + "مرحبا بك";
        }

        private void DeskTopForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            loginForm.clearFields();
            loginForm.Show();
        }

        private void EvalButtonToolStripButton_Click(object sender, EventArgs e)
        {
            EvaluationForm form = new EvaluationForm();
            form.currentUser = currentUser;
            form.Show();
            form.MdiParent = this;
        }

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            ReportForm R = new ReportForm();
            R.ShowDialog();
        }
    }
}
